/*
  Copyright 2011 Keith E. Laidig

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package org.aimj.tools;
import org.aimj.tools.*;
public class pAF extends AF {
    private Integer term;

    public pAF(Centre origin, Double expon, Integer term) {
        super(origin, expon);
	this.term = term;  // 1 -> X, 2 -> Y, 3 -> Z
    }
    private final Double TWO = 2.0;
    // determine value of BF
    public Double getBFValue(Centre position) {
        return (position.getL(term) - origin.getL(term)) 
             * Math.exp(-expon*origin.distanceSquared(position));
    }
    public Double getGXValue(Centre position) {
        return -2.0 * expon * origin.getDelX(position) * getBFValue(position);
    }
    public Double getGYValue(Centre position) {
        return -2.0 * expon * origin.getDelY(position) * getBFValue(position);
    }
    public Double getGZValue(Centre position) {
        return -2.0 * expon * origin.getDelZ(position) * getBFValue(position);
    }
}
